//
#include "postform.h"
#include "ui_postform.h"
#include <QSettings>

PostForm::PostForm(QWidget *parent) : QWidget(parent), ui(new Ui::PostForm)
{
    ui->setupUi(this);
    readSettings();
//    ui->postTreeWidget->setColumnWidth(0, 140);
}

PostForm::~PostForm()
{
    writeSwttings();
    delete ui;
}

void PostForm::changeEvent(QEvent *e)
{
    QWidget::changeEvent(e);
    switch (e->type())
    {
        case QEvent::LanguageChange:
            ui->retranslateUi(this);
            break;
        default:
            break;
    }
}

void PostForm::readSettings()
{
    QSettings settings("botva.ini", QSettings::IniFormat);
    settings.beginGroup("PostWindow");
    ui->postSplitter->restoreState(settings.value("postSplitterSizes").toByteArray());
    settings.endGroup();
}

void PostForm::writeSwttings()
{
    QSettings settings("botva.ini", QSettings::IniFormat);

    settings.beginGroup("MainWindow");
    settings.setValue("postSplitterSizes", ui->postSplitter->saveState());

}
